﻿using System;
using System.Drawing;
using System.Drawing.Imaging;
using SpiderMaster.AspNet.UI;

namespace SpiderMaster.AspNet.TradingSystem
{
    public partial class ImageManager
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CurrentImageByteArray"></param>
        /// <param name="SiteOrUserName">The name for copyright tag.</param>
        /// <returns></returns>
        public static Byte[] ApplyWaterMarkToImage(byte[] CurrentImageByteArray, string SiteOrUserName)
        {
            Image imageWithoutWaterMark = Utility.ConvertByteArrayToImage(CurrentImageByteArray, ImageFormat.Jpeg);

            // Example: WaterMarkSettings wms = new WaterMarkSettings(new Percent(10), new Percent(10));
            Image imageWithWaterMark = (Image)new WaterMarkedImage(imageWithoutWaterMark, SiteOrUserName);

            return Utility.ConvertImageToByteArray(imageWithWaterMark, ImageFormat.Jpeg);
        }
    }
}